package home_8_12;

import java.util.Arrays;

/**
 * 有2个多维数组分别如下所示
 *
 * 2  3  4        1 5 2 8
 *        和     5 9 10 -3
  *4 6 8        2 7 -5 -18
 * 按照如下方式进行运算。生成一个2行4列的数组。此数组的第1行1列是2*1+3*5+4*2第1行2列是2*5+3*9+4*7 第2行1列是4*1+6*5+8*2 依次类推。
 */
public class home04 {
    public static void main(String[] args) {
        int[][] x = {
                {2,3,4},
                {4,6,8},
        };
        int [][] y = {
                {1,5,2,8},
                {5,9,10,-3},
                {2,7,-5,-18}
        };


        chengJi(x,y);
    }
    public static int[][] chengJi(int num1[][],int num2[][]) {
        int[][] z = new int[num2.length][];
        for (int i = 0; i < num2.length; i++) {
            z = new int[num2.length][num2[i].length];
            for (int j = 0; j < num2[i].length; j++) {
                int x = num1[i][j];
                int y = num2[i][j];

                z[i][j] = num1[i][j] * num2[i][j];

            }

        }

        Arrays.toString(z);
        System.out.println(z);
        return z;
    }

}
